<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<title>Insert title here</title>
	<link href="<%=request.getContextPath() %>/resource/css/themes/default/easyui.css" rel="stylesheet" type="text/css" />
	<link href="<%=request.getContextPath() %>/resource/css/themes/icon.css" rel="stylesheet" type="text/css" />
	<link href="<%=request.getContextPath() %>/resource/css/portal.css" rel="stylesheet" type="text/css" />
	<link href="<%=request.getContextPath() %>/resource/css/sketoolweb-admin.css" rel="stylesheet" type="text/css" />
	<script src="<%=request.getContextPath() %>/resource/js/jquery-1.8.2.js" type="text/javascript" charset="utf-8"></script>
	<script src="<%=request.getContextPath() %>/resource/js/jquery.easyui.min.js" type="text/javascript" charset="utf-8"></script>
	<script src="<%=request.getContextPath() %>/resource/js/jquery.portal.js" type="text/javascript" charset="utf-8"></script>
	<script src="<%=request.getContextPath() %>/resource/js/ske-constants.js" type="text/javascript" charset="utf-8"></script>
	<script src="<%=request.getContextPath() %>/resource/js/ske-common.js" type="text/javascript" charset="utf-8"></script>
	<script src="<%=request.getContextPath() %>/resource/js/sketoolweb-admin.js" type="text/javascript" charset="utf-8"></script>
	<script type="text/javascript">
		var portal;
		var centerTabs;
		
		$(function() {
			centerTabs = $('#centerTabs').tabs({
	            fit : true,
	            border : false
	        });
			
			portal = $('#portals').portal({
	            border : false,
	            fit : true
	        });

			addPortal(0);
			addPortal(2);
			
			$(".menu-items .menu-item a").click(function() {
	            addTab({
	                title : $(this).text(),
	                url : $(this).attr("href")
	            });
	            return false;
	        });
		});
	
		function addTab(node) {
			if (centerTabs.tabs('exists', node.title)) {
				refreshTab(node.title);
				centerTabs.tabs('select', node.title);
			} else {
				if (centerTabs.tabs('tabs').length > 6) {
					$.messager.show({
						msg : '打开Tab数量过多，请先关闭后在打开...',
						title : '提示'
					});
					return;
	            }
				if (node.url && node.url.length > 0) {
					$.messager.progress({
						text : '正在加载...',
						interval : 100
					});
					window.setTimeout(function() {
						try {
							$.messager.progress('close');
						} catch (e) {
						}
					}, 0);
					centerTabs.tabs('add', {
						title : node.title,
						closable : true,
						iconCls : node.iconCls,
						content : '<iframe src="' + node.url + '" frameborder="0" style="border:0;width:100%; height:100%;"></iframe>',
						tools : [{
							iconCls : 'icon-mini-refresh',
							handler : function() {
								refreshTab(node.title);
							}
						}]
					});
				} else {
					$.messager.show({
						msg : '找不到页面',
						title : '提示'
					});
					return;
				}
			}
		}

	    function refreshTab(title) {
	        var tab = centerTabs.tabs('getTab', title);
	        centerTabs.tabs('update', {
	            tab : tab,
	            options : tab.panel('options')
	        });
	    }
	    
	    function addPortal(num) {
	    	var p = $('<div></div>').appendTo('body');
			p.panel({
			    title: '测试1',
			    height:150,
			    closable: true,
			    collapsible: true
			});
			
			$('#portals').portal('add', {
				panel: p,
			    columnIndex: num
			});
	    }
	</script>
</head>
<body class="easyui-layout">
    <div region="north" border="false" class="admin-head">
    	<div class="title fleft">
    		欢迎来到SkeToolWeb后台管理
    	</div>
    	<div class="button fright">
    		你好，管理员
			<a href="javascript:void(0)" id="sb1" class="easyui-linkbutton" data-options="plain:true" onClick="">修改密码</a>
			<a href="javascript:void(0)" id="mb3" class="easyui-linkbutton" data-options="plain:true" onclick="adminAjaxLogout()">退出系统</a>
    	</div>
    	<div class="cboth"></div>
    </div>  
    <div region="south" style="height:30px;" border="false"></div>  
    <div region="west" split="true" title="功能菜单" style="width:200px;">
    	<div class="easyui-accordion" fit="true" border="false">
		    <div title="导航管理">  
		        <div class="easyui-panel" fit="true" border="false" style="padding: 5px;">
					<ul class="menu-items">
						<li class="menu-item">
							<a href="<%=request.getContextPath() %>/admin/hotGuideManager">热门导航管理</a>
						</li>
					</ul>
				</div>
		    </div>
		    <div title="用户管理">  
		        <div class="easyui-panel" fit="true" border="false" style="padding: 5px;">
					<ul class="menu-items">
						<li class="menu-item">
							<a href="<%=request.getContextPath() %>/admin/userManager">用户管理</a>
						</li>
					</ul>
				</div> 
		    </div>
		    <div title="系统管理">  
				<div class="easyui-panel" fit="true" border="false" style="padding: 5px;">
					<ul class="menu-items">
						<li class="menu-item">
							<a href="test">菜单1</a>
						</li>
						<li class="menu-item">
							<a href="test">菜单2</a>
						</li>
						<li class="menu-item">
							<a href="">菜单3</a>
						</li>
					</ul>
				</div>
		    </div>
		</div>
    </div>  
    <div region="center">
    	<div id="centerTabs">
    		<div title="系统公告" border="false" style="overflow: hidden;">
				<div id="portals" style="position: relative;">
					<div></div>
					<div></div>
					<div></div>
					<div></div>
				</div>
			</div> 
		</div>
    </div>  
</body>
</html>